var x = "";
let PoemChange = function (){
let i = Math.trunc(Math.random()*10%5)
//console.log(i);
	switch(i){
		case 0:
			x="苟利国家生死以，岂因祸福避趋之";
			break;
		case 1:
			x="苟无新衣裳，曷用光我身";
			break;
		case 2:
			x="苟非圣贤心，孰能造化该";
			break;
		case 3:
			x="苟能制侵陵，岂在多杀伤";
			break;
		case 4:
			x="白云深处有人家，我又没说钦定他";
			break;
	}
	document.getElementById("poem").innerHTML=x;
}
// const Tucao = [];
let Tucao = [];
 let TuCaoTiJiao = function(){
	var str1 = document.getElementById("Main-text");
	if(str1.value == ""||str1.value == null){
		alert("吐槽内容不能为空！");
	}else if(str1.value.length>140){
		alert("单次吐槽字数不能超过140！");
	}else{
	Tucao.push(str1.value);
	
	//console.log(str1.value);
	//console.log(Tucao);
	document.getElementById("Main-text").value=null;}
	return ;
}
//评论显示
let ShowText = function(){
		var Parent = document.getElementById("DisPlayText");
		//var ChildNodes = new Array[];
		Parent.innerHTML = '';		
			//var btns[] = this.getElementsByTagName("button");
		for (let i = 0; i < Tucao.length; i++) {
			let divs = document.createElement('div');
			let btn = document.createElement('button'); 
			//alert(divs.parentNode);
			divs.class = "Displaytext";
			divs.id = "i";
			divs.innerText = Tucao[i]; 
			btn.className = "Del";
			btn.innerText = "删除";
			btn.onclick = function(){
				Tucao = Tucao.splice(i,i);//？最后一条删不掉？
				console.log(Tucao);
				//alert(i);
				Parent.removeChild(divs);
				Parent.removeChild(btn);
			}
			document.getElementById("DisPlayText").appendChild(divs);
			document.getElementById("DisPlayText").appendChild(btn);
			document.getElementById("DisPlayText").appendChild(document.createElement('br'));
            //删除评论
			//let deletC = function(){}
			//获取新生成按钮节点的数量并各自附加一个响应函数
	
			}


}
//let Login = function(){
	//let entrance = Number(prompt("请输入密码",));
	//console.log(entrance);
	//if(entrance != 123456){
		//window.close();
	//}
	//return ;
//}
